class CategoryController < ApplicationController
	before_filter :find_category
	
	def index
		if @category.is_static?
			render :partial=>"includes/page", :object=>@category.page,  :layout=>"application"
		else
			@posts = @category.posts.paginate(:page=>params[:page], :per_page=>10, :order=>"created_at DESC")
		end
	end
	
	private
	
	def find_category
		@category = Category.find_by_slug(params[:category_id])
		raise ActiveRecord::RecordNotFound.new "category #{params[:category_id]} not found" if @category.nil?
	end
end
